package tds.model29;
/**
 * @Company 杭州先锋电子技术股份有限公司
 * @ClassName Client
 * @Description
 * @author tds
 * @Date 2020/2/8 21:52
 * @version 1.0.0
 */
public class Client {
    public static void main(String[] args) {
        // 创建访问者
        Vistor v1 = new ConcreteVistor1("张三");
        Vistor v2 = new ConcreteVistor2("李四");

        // 创建被访问者
        Element e1 = new ConcreateElementA("王五");
        Element e2 = new ConcreateElementB("赵六");

        // 管理被访问者的类
        ObjectStructure objectStructure = new ObjectStructure();
        objectStructure.attach(e1);
        objectStructure.attach(e2);

        // 访问者访问所有被访问者
        objectStructure.accept(v1);
        objectStructure.accept(v2);
    }
}
